package file;

import com.google.common.annotations.VisibleForTesting;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * User: heihaier@xfuweng.com
 * Date: 2015/7/6
 * Time: 17:40
 */
public class IoTest {

    public static void main(String[] args) {

        FileInputStream fis = null;

        try {
            fis = new FileInputStream("E:\\test\\mongodb\\pom.xml");
            int hasRead = 0;
            byte[] buf = new byte[1024];

            while ((hasRead = fis.read(buf)) > 0) {
                System.out.println(new String(buf, 0, hasRead));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {

            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                ;
            }
        }
    }
}
